from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
# driver_path = r'C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe'
# driver = webdriver.Chrome(executable_path=driver_path)
driver = webdriver.Chrome()
# driver.get("http://www.qfedu.com/")
# print(driver.page_source) #获取源代码
#
# driver.close() #关闭一个窗口
# driver.quit() #关闭所有的窗口

# driver.get('https://tieba.baidu.com')
# driver.find_element_by_id('wd1')
# driver.find_element(by='id',value='wd1')
# driver.find_element_by_name('kw1')
# driver.find_element_by_css_selector("#wd1")
# kw = driver.find_element_by_xpath('//*[@id="wd1"]')
# kw.send_keys("NBA最新交易")
# time.sleep(3)
# kw.clear()
# print(driver.page_source)

driver.get("https://weibo.com")

# driver.execute_script("window.scrollTo(0,999)")

#下啦加载新内容
while True:
    for i in range(20):
        driver.execute_script("window.scrollBy(0,999)")
        time.sleep(3)
    driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")
    break